From: Florian Müllner Date: Sat, 21 Jul 2018 05:08:33 +0000 (+0200) Subject: dash: Directly tween actors X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~839^2^2~60 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8eb88d17fea6692eaa03d1245486364391e83600;p=gnome-shell.git dash: Directly tween actors Dash items are currently animated via the custom "childScale" and "childOpacity" properties. However since commit efb3025d8cdb, those properties actually control the scale-x/scale-y and opacity properties of the actor itself (not the child), so cut out the intermediate custom properties in favor of the "real" ones. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22 --- diff --git a/js/ui/dash.js b/js/ui/dash.js index d3206aa4f..75749d48f 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -32,6 +32,9 @@ class DashItemContainer extends St.Widget { _init() { super._init({ style_class: 'dash-item-container', pivot_point: new Clutter.Point({ x: .5, y: .5 }), + scale_x: 0, + scale_y: 0, + opacity: 0, x_expand: true, x_align: Clutter.ActorAlign.CENTER }); @@ -42,10 +45,11 @@ class DashItemContainer extends St.Widget { this.label_actor = this.label; this.child = null; - this._childScale = 0; - this._childOpacity = 0; this.animatingOut = false; + this.connect('notify::scale-x', () => this.queue_relayout()); + this.connect('notify::scale-y', () => this.queue_relayout()); + this.connect('destroy', () => { if (this.child != null) this.child.destroy(); @@ -127,9 +131,6 @@ class DashItemContainer extends St.Widget { this.child = actor; this.add_actor(this.child); - - this.set_scale(this._childScale, this._childScale); - this.set_opacity(this._childOpacity); } show(animate) { @@ -138,8 +139,9 @@ class DashItemContainer extends St.Widget { let time = animate ? DASH_ANIMATION_TIME : 0; Tweener.addTween(this, - { childScale: 1.0, - childOpacity: 255, + { scale_x: 1.0, + scale_y: 1.0, + opacity: 255, time: time / 1000, transition: 'easeOutQuad' }); @@ -155,37 +157,14 @@ class DashItemContainer extends St.Widget { this.animatingOut = true; Tweener.addTween(this, - { childScale: 0.0, - childOpacity: 0, + { scale_x: 0, + scale_y: 0, + opacity: 0, time: DASH_ANIMATION_TIME / 1000, transition: 'easeOutQuad', - onComplete: () => { - this.destroy(); - } + onComplete: () => this.destroy() }); } - - set childScale(scale) { - this._childScale = scale; - - this.set_scale(scale, scale); - this.queue_relayout(); - } - - get childScale() { - return this._childScale; - } - - set childOpacity(opacity) { - this._childOpacity = opacity; - - this.set_opacity(opacity); - this.queue_redraw(); - } - - get childOpacity() { - return this._childOpacity; - } }); var ShowAppsIcon = GObject.registerClass( @@ -352,8 +331,7 @@ var Dash = class Dash { this._container.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS); this._showAppsIcon = new ShowAppsIcon(); - this._showAppsIcon.childScale = 1; - this._showAppsIcon.childOpacity = 255; + this._showAppsIcon.show(false); this._showAppsIcon.icon.setIconSize(this.iconSize); this._hookUpLabel(this._showAppsIcon);